package com.juxing.webserver.action.common;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import com.juxing.service.accountCenter.IAccountCenterService;
import com.juxing.service.imCenter.IImCenterService;
import com.juxing.service.imCenter.bean.UserRcTokenBean;
import com.juxing.service.liveCenter.ILiveCenterService;
import com.juxing.webserver.action.BaseAction;

@Controller
@RequestMapping("common/main")
public class MainAction extends BaseAction {
	
	private Logger logger = LoggerFactory.getLogger(MainAction.class);
	
	@Autowired
	private ILiveCenterService liveCenterService;
	@Autowired
	private IAccountCenterService accountCenterService;
	@Autowired
	private IImCenterService imCenterService;
	
	/**
	 * 最小化启动
	 * @param request
	 * @param response
	 * @param userId
	 * @return
	 */
	@RequestMapping("minimizeStart.json")
	public ModelAndView minimizeStart(HttpServletRequest request, HttpServletResponse response
			,@RequestParam int userId		//用户ID
			) {
		
		ModelAndView view = this.initSuccessView("common/minimizeStart");
		UserRcTokenBean rcToken = imCenterService.getUserRcToken(userId);
		view.addObject("rcToken", rcToken);
		
		return this.encryptedView(request, response, view);
	}
	
	/**
	 * 推荐主页
	 * @param request
	 * @param response
	 * @param userId
	 * @return
	 */
	@RequestMapping("recommendPage.json")
	public ModelAndView recommendPage(HttpServletRequest request, HttpServletResponse response
			,@RequestParam int userId		//用户ID
			) {
		return this.initSuccessView();
	}
}
